<?php

namespace App\Jobs;

use App\Notifications\CompletedExportNotify;
use App\User;
use Illuminate\Bus\Queueable;
use Illuminate\Contracts\Queue\ShouldQueue;
use Illuminate\Foundation\Bus\Dispatchable;
use Illuminate\Queue\InteractsWithQueue;
use Illuminate\Queue\SerializesModels;

class CompletedExport implements ShouldQueue
{
    use Dispatchable, InteractsWithQueue, Queueable, SerializesModels;

    private $path;

    private $user;

    private $title;

    /**
     * Create a new job instance.
     *
     * @return void
     */
    public function __construct($path, $title, User $user)
    {
        $this->path = $path;
        $this->user = $user;
        $this->title = $title;
    }

    /**
     * Execute the job.
     *
     * @return void
     */
    public function handle()
    {
        $this->user->notify(new CompletedExportNotify($this->user, $this->path, $this->title));
    }
}
